#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
	int N = 0, K = 0; int arr[101]; int t = 0;
	scanf("%d %d", &N, &K);
	getchar();
	for (int i = 0; i < N; i++)
	{
		scanf("%d", &arr[i]);
	}
	for (int m = 0; m < K; m++)
	{
		for (int j = 0; j < N - 1; j++)
		{
			if (arr[j] > arr[j + 1])
			{
				t = arr[j];
				arr[j] = arr[j + 1];
				arr[j + 1] = t;
			}
		}
	}
	printf("%d ", arr[0]);
	for (int n = 1; n < N; n++)
	{
		printf("%d ", arr[n]);
	}
	return 0;
}